local jiaoyi = fk.CreateSkill {
  name = "emo__jiaoyi",
}

jiaoyi:addEffect(fk.RoundStart, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(jiaoyi.name)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:doIndicate(player, room.alive_players)
    for _, p in ipairs(room:getAlivePlayers()) do
      if not p.dead then
        p:drawCards(1, jiaoyi.name)
      end
    end
    for _, p in ipairs(room:getOtherPlayers(player)) do
      if not p.dead then
        if p:isNude() or #room:askToDiscard(p, {
          max_num = 1, min_num = 1, include_equip = true, pattern = ".|.|spade,club", skill_name = jiaoyi.name,
          prompt = "#emo__jiaoyi-discard:"..player.id
        }) == 0 then
          room:addTableMark(p, "@@emo__jiaoyi-round", player.id)
        end
      end
    end
  end,
})

jiaoyi:addEffect("prohibit", {
  is_prohibited = function(self, from, to, card)
    return card and card.color == Card.Black and from and table.contains(from:getTableMark("@@emo__jiaoyi-round"), to.id)
  end,
})


Fk:loadTranslationTable{
  ["emo__jiaoyi"] = "交谊",
  [":emo__jiaoyi"] = "每轮开始时，你可以令每名角色各摸一张牌，然后令其他角色依次选一项：1.弃置一张黑色牌，2.本轮其使用的黑色牌无法指定你为目标。",
  ["#emo__jiaoyi-discard"] = "交谊：弃置一张黑色牌，否则本轮无法对 %src 使用黑色牌",
  ["#emo__jiaoyi_prohibit"] = "交谊",
  ["@@emo__jiaoyi-round"] = "交谊",
}

return jiaoyi
